/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.HashSet;
import java.util.Set;

/**
 * <p>Project: jse2303 - Set4
 * <p>Powered by webrx On 2023-07-19 16:04:23
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Set4 {
    public static void main(String[] args) {

        Set<Integer> ii = new HashSet<>();
        System.out.println(ii.add(1));
        System.out.println(ii.add(1));
        System.out.println(ii.add(1));
        System.out.println(ii.add(1));
        System.out.println(ii.size());
        System.out.println("------------------");

        String s1 = new String("ok");
        Set<String> ss = new HashSet<>();
        ss.add(s1);

        String s2 = new String("ok2");
        System.out.println(ss.add(s2));

        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
        System.out.println(ss.size());

        for (String s : ss) {
            System.out.println(s == s1);
            System.out.println(s == s2);
        }
    }
}
